package resizeableText;
import java.awt.Font;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JFrame;
import javax.swing.JLabel;


public class ResizeableText {
	JFrame frame;
	public static void main(String[] args) {
		ResizeableText text = new ResizeableText();
	}
	ResizeableText(){
		init();
	}
	void init(){
		frame = new JFrame();
		frame.setVisible(true);
		//frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.setTitle("Resizeable Text");
		frame.setLayout(null);
		frame.setSize(100, 100);
		
		final JLabel label = new JLabel("Text");
		frame.add(label);
		label.setFont(new Font("Times New Roman", 12, frame.getSize().height));
		label.setBounds(0, 0, frame.getSize().width, frame.getSize().height);
		
		frame.addComponentListener(new ComponentListener() {
			
			@Override
			public void componentShown(ComponentEvent arg0) {

			}
			
			@Override
			public void componentResized(ComponentEvent arg0) {
				label.setBounds(0, 0, frame.getSize().width, frame.getSize().height);
				label.setFont(new Font("Times New Roman", 0, frame.getSize().height-30));
				//label.get
			}
			
			@Override
			public void componentMoved(ComponentEvent arg0) {
			
			}
			
			@Override
			public void componentHidden(ComponentEvent arg0) {
			
			}
		});
	}

}
